<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<style type="text/css">
		.mybody {
			width: 100%;
		}

		.head {
			width: 100%;
			text-align: center;
			margin-top: 56px;
		}

		.head p {
			color: red;
			font-size: 30px;
			margin: 0;
			text-shadow: 1px 1px 0px #000000;
		}

		.content {
			width: 100%;
		}

		.contentOne {
			border: 1px solid;
			width: 358px;
			height: 40px;
			border-color: gainsboro;
			border-radius: 4px 4px 0px 0px;
			margin-top: 26.5px;
			margin-left: 39.2%;
			background-color: #f5f5f5;
		}

		.contentOne b {
			font-size: 14px;
			margin-left: 4%;
			line-height: 40px;
		}

		.contentTwo {
			border: 1px solid;
			width: 358px;
			height: 243.2px;
			border-color: gainsboro;
			margin-left: 39.2%;
			border-top: none;
			border-radius: 0px 0px 4px 4px;
		}

		.con {
			margin-left: 4.1%;
			padding-top: 35px;
		}

		.con1 {
			border: 1.3px solid;
			border-color: gainsboro;
			border-radius: 4px 0px 0px 4px;
			width: 34px;
			height: 32px;
			background-color: #f5f5f5;
			text-align: center;
			float: left;
		}

		.con1 img {
			height: 12.7px;
			margin-top: 11px;
		}

		.con2 {
			border-bottom: none;
			border: 1.3px solid;
			border-color: gainsboro;
			border-radius: 0px 4px 4px 0px;
			width: 306px;
			height: 32px;
			margin-left: 20px;
		}

		.con2 input {
			border: none;
			height: 28px;
			width: 285px;
			border-radius: 0px 4px 4px 0px;
			font-size: 14px;
			margin-top: 1px;
			margin-left: 1px;
		}

		.con3 {
			margin-left: 4.1%;
			padding-top: 15px;
		}

		.con4 {
			border: 1.3px solid;
			border-color: gainsboro;
			border-radius: 4px 0px 0px 4px;
			width: 34px;
			height: 32px;
			background-color: #f5f5f5;
			text-align: center;
			float: left;
		}

		.con4 img {
			height: 12.7px;
			margin-top: 11px;
		}

		.con5 {
			border-bottom: none;
			border: 1.3px solid;
			border-color: gainsboro;
			border-radius: 0px 4px 4px 0px;
			width: 306px;
			height: 32px;
			margin-left: 20px;
		}

		.con5 input {
			border: none;
			height: 28px;
			width: 285px;
			border-radius: 0px 4px 4px 0px;
			font-size: 14px;
			margin-top: 1px;
			margin-left: 1px;

		}

		button {
			border: none;
			background-color: #428bca;
			border-radius: 4px;
			width: 54px;
			height: 34px;
			color: white;
			margin-top: 14px;
			margin-left: 40.8%;
			font-size: 14px;
		}

		hr {
			width: 90%;
			margin-top: 20px;
			opacity: 0.2;
		}

		.con10 {
			font-size: 14px;
			margin-top: 20px;
			margin-left: 4%;
		}

		.con10 a {
			color: #42aae2;
			text-decoration: none;
		}
	</style>
	<body>
		<div class="mybody">
			<div class="head">
				<p>注册账号</p>
			</div>
			<div class="content">
				<div class="contentOne">
					<b>请输入注册信息</b>
				</div>
				<div class="contentTwo">
					<div class="con">
						<div class="con1">
							<img src="img/图层%201.png">
						</div>
						<div class="con2">
							<input type="text" name="" id="user" value="" placeholder="   在此输入手机号注册" />
						</div>
					</div>
					<div class="con3">
						<div class="con4">
							<img src="img/图层%202.png">
						</div>
						<div class="con5">
							<input type="password" name="" id="pass" value="" placeholder="   在此输入密码" />
						</div>
					</div>
					<button type="button">注册</button>
					<hr>
					<div class="con10">
						<a href="a登录.html">返回登录</a>
					</div>
				</div>

			</div>
		</div>
		<script src="js/new_file.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			
			
			//回车键等于注册按钮
			$(window).keydown(function (event) {
				if (event.keyCode == 13) {
					$("button").click();
				}
			});
			
		
		
			localStorage.clear()
			var bds = /^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\d{8}$/
			$("button").click(function() {

				var user1 = $("#user").val()
				var pass1 = $("#pass").val()
				if (user1.search(bds) == -1) {
					alert('手机号格式输入错误')
				} else if (pass1 == '' || pass1 == null) {
					alert('请添加密码')
				} else {
					$.ajax({
						url: "http://student.qhynice.top/j_register.php",
						type: "get",
						data: {
							'user': user1,
							'pass': pass1
						},
						dataType: "json",
						success: function(data) {
							console.log(data.status)
							if (data.status == 0) {
								alert('账号已存在，请重新输入')
							} else if (data.status == 2) {
								alert('账号格式错误，请重新输入')
							} else if (data.status == 1) {
								alert('注册成功')
							}
						}
					})
				}
			})
		</script>
	</body>
</html>
